using System;
using System.IO;

namespace Kassandra.Core.Repositories
{
    public class CopyFile:IPersistFile
    {
        private string _sourceFile;
        private string _destinationFile;

        public IPersistFile From(string sourceFile)
        {
            _sourceFile = sourceFile;
            return this;
        }

        public IPersistFile To(string destinationFile)
        {
            _destinationFile = destinationFile;
            return this;
        }

        public void Now()
        {
            if (string.IsNullOrEmpty(_sourceFile))
            {
                throw new ArgumentException("Must provide a source file");
            }

            if (string.IsNullOrEmpty(_destinationFile))
            {
                throw new ArgumentException("Must provide a destination file");
            }

            File.Copy(_sourceFile, Environment.CurrentDirectory + @"\images\" + _destinationFile + ".tif");
        }
    }
}